package com.zuihai.app.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.zuihai.app.mvp.contract.MainContract;
import com.zuihai.app.mvp.model.api.service.MainService;
import com.zuihai.app.mvp.model.entity.CheckUpdataResponse;

import javax.inject.Inject;

import rx.Observable;

/**
 * Created by Administrator on 2017/7/6 0006.
 */

@ActivityScope
public class MainModel extends BaseModel implements MainContract.Model {
    private Gson mGson;
    private Application mApplication;
    private MainService mMainService;

    @Inject
    public MainModel(IRepositoryManager repositoryManager, Gson gson, Application application) {
        super(repositoryManager);
        this.mGson = gson;
        this.mApplication = application;
        mMainService = repositoryManager.obtainRetrofitService(MainService.class);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<CheckUpdataResponse> checkUpdata() {
        return mMainService.checkUpdata();
    }
}
